package cn.rongcloud.im.utils;

import android.content.Context;
import android.view.WindowManager;

/**
 * Created by Administrator on 2017/3/17.
 */

public class ScreenUtils {
    /**
     * 获得屏幕的宽度
     * @param context    上下文
     * @return     屏幕的宽度
     */
    public static int getScreenWidth(Context context){
        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        int width = wm.getDefaultDisplay().getWidth();
        return width;
    }

    /**
     * 获取屏幕的高度
     * @param context    上下文
     * @return    屏幕的高度
     */
    public static int getScreenHeight(Context context){
        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        int height = wm.getDefaultDisplay().getHeight();
        return height;
    }
}
